package cn.legend.travel.destination.main.service.impl;

import cn.legend.travel.destination.main.dao.persist.repository.IDelicacyRepository;
import cn.legend.travel.destination.main.dao.persist.repository.IDistrictRepository;
import cn.legend.travel.destination.main.pojo.vo.DelicacyVO;
import cn.legend.travel.destination.main.pojo.vo.DistrictVO;
import cn.legend.travel.destination.main.service.IDelicacyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DelicacyServiceImpl implements IDelicacyService {
    @Autowired
    private IDelicacyRepository delicacyRepository;
    @Autowired
    private IDistrictRepository districtRepository;

    @Override
    public List<DelicacyVO> selectBydestinationId(Long destinationId) {
        return delicacyRepository.selectBydestinationId(destinationId);
    }

    @Override
    public List<DelicacyVO> selectBydestinationName(String destinationName) {
        DistrictVO districtVO = districtRepository.selectListByName(destinationName);
        return delicacyRepository.selectBydestinationId(districtVO.getId());
    }
}
